<template>
    <el-dialog :close-on-click-modal="false"  ref="dialogform" title="查看数据" :visible.sync="dialogVisible" width="60%" :before-close="handleClose">
        <el-descriptions>
            <el-descriptions-item label="作业类型">{{ workType[dataInfo.workType] }}</el-descriptions-item>
            <el-descriptions-item label="养殖设施">{{ dataInfo.facilityName }}</el-descriptions-item>
            <el-descriptions-item label="批次名称">{{ dataInfo.batchName }}</el-descriptions-item>
            <el-descriptions-item label="作业人">{{ dataInfo.staffName }}</el-descriptions-item>
            <el-descriptions-item label="作业状态">{{ workStatus[dataInfo.workStatus] }}</el-descriptions-item>
            <el-descriptions-item label="作业时间">{{ dataInfo.workStartTime + '至' + dataInfo.workEndTime
                }}</el-descriptions-item>
        </el-descriptions>

        <el-table v-if="dataInfo.workTaskDetailList && dataInfo.workTaskDetailList.length > 0"
            :data="dataInfo.workTaskDetailList" style="width: 100%" border>
            <el-table-column type="index" width="50" label="序号">
            </el-table-column>
            <el-table-column prop="materialName" label="用药名称">
            </el-table-column>
            <el-table-column prop="num" label="用药数量">
                <template slot-scope="scope">
                    {{ scope.row.num }}{{ scope.row.unitName  }}
                </template>
            </el-table-column>
        </el-table>
        <span slot="footer" class="dialog-footer">
            <el-button @click="cancel">取 消</el-button>
        </span>
    </el-dialog>
</template>
<script>

export default {
    components: {},
    props: {
        addEditFlag: {
            type: String,
            default: () => {
                return 'add'
            }
        },
        dataInfo: {
            type: Object,
            default: () => {
                return {}
            }
        },
        dialogVisible: {
            type: Boolean,
            default: () => {
                return false
            }
        }
    },
    data() {
        return {
            workStatus: {
                COMPLETE: "按时完成",
                LATE_COMPLETE: "逾期完成",
                LATE_PENDING_PROCESS: "逾期待处理",
                PENDING_PROCESS: "待处理",
                VOIDED: "已作废"
            },
            workType: {
                CHANGE_WATER: "换水作业",
                HANGING_NET: "吊网作业",
                EXPOSED_NET: "漏网作业",
                FEEDING: "饲喂作业",
                DISINFECTION_WATER:'消杀作业'
            },
        }
    },
    watch: {},
    mounted() { },
    methods: {
        //取消关闭
        cancel() {
            this.$emit("closeDialog")
        },
        handleClose(done) {
            this.$confirm('确认关闭？')
                .then(_ => { this.cancel() })
                .catch(_ => { });
        }
    }
};
</script>
<style lang="scss" scoped></style>